package com.itheima;

import com.itheima.dao.impl.BookDaoImpl;
import com.itheima.service.impl.BookServiceImpl;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppForDISet {
    public static void main( String[] args ) {
//        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//        BookService bookService = (BookService) ctx.getBean("bookService");
//        bookService.save();
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        BookServiceImpl bookService = (BookServiceImpl)ctx.getBean("bookService");
        bookService.save();
        System.out.println("----------------------------");
        BookDaoImpl bookDao = (BookDaoImpl) ctx.getBean("bookDao");
        bookDao.save();
    }
}
